home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / PROGEDIT / 0748.ZIP / PARA < prev    next >
Text File  |  1986-12-29  |  891b  |  43 lines

  1. /* These macros move up and down one paragraph. C programmers who want */
  2. /* to move up and down one function can alter these macros. */
  3.  
  4. init()
  5. {
  6.   assign_key("downpara", 14);
  7.   assign_key("uppara",   16);
  8. }
  9.  
  10. downpara()
  11. {
  12.   while (!is_line_blank(currline()) && currlinenum() < lastlinenum())
  13.     down();
  14.   while (is_line_blank(currline())  && currlinenum() < lastlinenum())
  15.     down();
  16. }
  17.  
  18. uppara()
  19. {
  20.   if (!is_line_blank(currline()))
  21.     up();      /* don't get stuck at first line of para */
  22.   while (is_line_blank(currline())  && currlinenum() > 1)
  23.     up();
  24.   while (!is_line_blank(currline()) && currlinenum() > 1)
  25.     up();
  26.   if (currlinenum() > 1)
  27.     down();
  28. }
  29.  
  30. is_line_blank(str)
  31.   string str;
  32. {
  33.   int i;
  34.   int len;
  35.  
  36.   len = strlen(str);
  37.  
  38.   for (i = 1;  i <= len;  i = i + 1)
  39.     if (substr(str, i, 1) != " ")
  40.       return 0;
  41.   return 1;
  42. }
  43.